

*ANES cumulative  with 2016
use "____________________________\anes_timeseries_cdf_dta_with_auth_scale\anes_timeseries_cdf.dta", clear



*DATA RECODING

*GENERAL ATTITUDES

*IDEOLOGY, LIB/CONS
*recode ideology scale -1 to 1 (extreme lib to extreme conservative)
gen ideology = 0
replace ideology=-1 if VCF0803==1
replace ideology=-.66 if VCF0803==2
replace ideology=-.33 if VCF0803==3
replace ideology=.33 if VCF0803==5
replace ideology=.66 if VCF0803==6
replace ideology=1 if VCF0803==7
replace ideology=. if VCF0803==9
replace ideology=. if VCF0803==0


*THERMOMETER  SCORES

*feminist therm

gen femtherm=VCF0253
replace femtherm=. if VCF0253>97

sort VCF0004
by VCF0004, sort: egen femthermmean=mean(femtherm)
by VCF0004, sort: egen femthermsd=sd(femtherm)
gen zfemtherm=(femtherm-femthermmean)/femthermsd



*black therm
gen blacktherm=VCF0206
replace blacktherm=. if VCF0206>97

sort VCF0004
by VCF0004, sort: egen blackthermmean=mean(blacktherm)
by VCF0004, sort: egen blackthermsd=sd(blacktherm)
gen zblacktherm=(blacktherm-blackthermmean)/blackthermsd




*therm for hispanics
gen hisptherm=VCF0217
replace hisptherm=. if VCF0217>97

sort VCF0004
by VCF0004, sort: egen hispthermmean=mean(hisptherm)
by VCF0004, sort: egen hispthermsd=sd(hisptherm)
gen zhisptherm=(hisptherm-hispthermmean)/hispthermsd



*therm for illegal aliens
gen alientherm=VCF0233
replace alientherm=. if VCF0233>97

sort VCF0004
by VCF0004, sort: egen alienthermmean=mean(alientherm)
by VCF0004, sort: egen alienthermsd=sd(alientherm)
gen zalientherm=(alientherm-alienthermmean)/alienthermsd



*therm for muslims; NOTE: CODED DIFF than other therms
gen muslimtherm=VCF9267
replace muslimtherm=. if VCF9267<0

sort VCF0004
by VCF0004, sort: egen muslimthermmean=mean(muslimtherm)
by VCF0004, sort: egen muslimthermsd=sd(muslimtherm)
gen zmuslimtherm=(muslimtherm-muslimthermmean)/muslimthermsd



*therm for poor
gen poortherm=VCF0223
replace poortherm=. if VCF0223>97

sort VCF0004
by VCF0004, sort: egen poorthermmean=mean(poortherm)
by VCF0004, sort: egen poorthermsd=sd(poortherm)
gen zpoortherm=(poortherm-poorthermmean)/poorthermsd





*therm for people on welfare
gen welfaretherm=VCF0220
replace welfaretherm=. if VCF0220>97

sort VCF0004
by VCF0004, sort: egen welfarethermmean=mean(welfaretherm)
by VCF0004, sort: egen welfarethermsd=sd(welfaretherm)
gen zwelfaretherm=(welfaretherm-welfarethermmean)/welfarethermsd





*therm for gays and lesbians
gen gaytherm=VCF0232
replace gaytherm=. if VCF0232>97

sort VCF0004
by VCF0004, sort: egen gaythermmean=mean(gaytherm)
by VCF0004, sort: egen gaythermsd=sd(gaytherm)
gen zgaytherm=(gaytherm-gaythermmean)/gaythermsd



*therm environmentalists
gen envtherm=VCF0229
replace envtherm=. if VCF0229>97

sort VCF0004
by VCF0004, sort: egen envthermmean=mean(envtherm)
by VCF0004, sort: egen envthermsd=sd(envtherm)
gen zenvtherm=(envtherm-envthermmean)/envthermsd



*therm christian fundamentalista
gen fundtherm=VCF0234
replace fundtherm=. if VCF0234>97

sort VCF0004
by VCF0004, sort: egen fundthermmean=mean(fundtherm)
by VCF0004, sort: egen fundthermsd=sd(fundtherm)
gen zfundtherm=(fundtherm-fundthermmean)/fundthermsd


*therm fund: reverse the polarity so negative equals cons position, positive equal lib position
gen fundtherm1=100-fundtherm
sort VCF0004
by VCF0004, sort: egen fundthermmean1=mean(fundtherm1)
by VCF0004, sort: egen fundthermsd1=sd(fundtherm1)
gen zfundtherm1=(fundtherm1-fundthermmean1)/fundthermsd1



*jews
gen jewtherm=VCF0205
replace jewtherm=. if VCF0205>97


sort VCF0004
by VCF0004, sort: egen jewthermmean=mean(jewtherm)
by VCF0004, sort: egen jewthermsd=sd(jewtherm)
gen zjewtherm=(jewtherm-jewthermmean)/jewthermsd


*asians

gen asiantherm=VCF0227
replace asiantherm=. if VCF0227>97


sort VCF0004
by VCF0004, sort: egen asianthermmean=mean(asiantherm)
by VCF0004, sort: egen asianthermsd=sd(asiantherm)
gen zasiantherm=(asiantherm-asianthermmean)/asianthermsd






*CONTROLS
*education
gen education = VCF0140
replace education =. if VCF0140>7
*male dummy
gen male =0
replace male=1 if VCF0104==1
replace male=. if VCF0104==0
*white dummy
gen white=0
replace white=1 if VCF0105a==1
replace white=. if VCF0105a==9
replace white=. if VCF0105a==.
*black dummy
gen black=0
replace black=1 if VCF0105a==2
replace black=. if VCF0105a==9
replace black=. if VCF0105a==.

*hisp dummy
gen hisp=0
replace hisp=1 if VCF0105a==5
replace hisp=. if VCF0105a==9
replace hisp=. if VCF0105a==.

*asian dummy
gen asian=0
replace asian=1 if VCF0105a==3
replace asian=. if VCF0105a==9
replace asian=. if VCF0105a==.

*other dummy
gen other=0
replace other=1 if VCF0105a==6
replace other=1 if VCF0105a==4
replace other=. if VCF0105a==9
replace other=. if VCF0105a==.


*age; note that there are inconsistencies in coding age after 90; 2012 has 90 as everyone over 90
gen age=VCF0101
replace age=90 if VCF0101>89
replace age=. if VCF0101==0
replace age=age/90
*south dummy
gen south=0
replace south=1 if VCF0113==1
*urban dummy
gen urban=0
replace urban=1 if VCF0111==1
replace urban=. if VCF0111==0

*party
gen pid3=0
replace pid3=1 if VCF0303==3
replace pid3=-1 if VCF0303==1
replace pid3=. if VCF0303==0


gen dem=0
replace dem=1 if pid3==-1
gen rep=0
replace rep=1 if pid3==1

*party id strength, positive equal republican
gen pid7=0 
replace pid7=-1 if VCF0301==1
replace pid7=-.66 if VCF0301==2
replace pid7=-.33 if VCF0301==3
replace pid7=.33 if VCF0301==5
replace pid7=.66 if VCF0301==6
replace pid7=1 if VCF0301==7
replace pid7=. if VCF0301==0


*church attendance (0 = never; 1 =every week)
gen churchattend=.
replace churchattend=0 if VCF0130==7
replace churchattend=0 if VCF0130==0
replace churchattend=0 if VCF0130==5
replace churchattend=.25 if VCF0130==4
replace churchattend=.5 if VCF0130==3
replace churchattend=.75 if VCF0130==2
replace churchattend=1 if VCF0130==1


gen religious=0
replace religious=1 if churchattend>.25
replace religious=. if churchattend==.


*AUTHORITARIAN SCALE; FIXED FLUID
*VCF9246: good manners
gen auth1=.
replace auth1=1 if VCF9246==3
replace auth1=.5 if VCF9246==2
replace auth1=0 if VCF9246==1
*obedience
gen auth2=.
replace auth2=1 if VCF9247==1
replace auth2=.5 if VCF9247==2
replace auth2=0 if VCF9247==3
*well behaved
gen auth3=.
replace auth3=1 if VCF9248==3
replace auth3=.5 if VCF9248==2
replace auth3=0 if VCF9248==1
*respect for elders
gen auth4=.
replace auth4=1 if VCF9249==3
replace auth4=.5 if VCF9249==2
replace auth4=0 if VCF9249==1

gen auth=auth1+auth2+auth3+auth4
gen fixed=.
replace fixed=1 if auth>=3
replace fixed=0 if auth<3
gen fluid=.
replace fluid=1 if auth<=1
replace fluid=0 if auth>1

*************************************************************************
*************************************************************************
*************************************************************************
*************************************************************************
*************************************************************************
*************************************************************************
*************************************************************************

*ANALYSIS

gen caseid=_n

*face to face sample only in 2012
svyset caseid [pweight=VCF0009x]


gen obamayears=0
replace obamayears=1 if VCF0004>2006
replace obamayears=. if VCF0004<1988




*raw change in therms before and after obama for Table 1

*therm averages by party, all races, before and after Obama
svy: mean blacktherm if dem==1 & VCF0004>1986 & VCF0004<2008
svy: mean blacktherm if dem==1 & VCF0004>2006
svy: mean blacktherm if rep==1 & VCF0004>1986 & VCF0004<2008
svy: mean blacktherm if rep==1 & VCF0004>2006

svy: mean hisptherm if dem==1 & VCF0004>1986 & VCF0004<2008
svy: mean hisptherm if dem==1 & VCF0004>2006
svy: mean hisptherm if rep==1 & VCF0004>1986 & VCF0004<2008
svy: mean hisptherm if rep==1 & VCF0004>2006

svy: mean asiantherm if dem==1 & VCF0004>1986 & VCF0004<2008
svy: mean asiantherm if dem==1 & VCF0004>2006
svy: mean asiantherm if rep==1 & VCF0004>1986 & VCF0004<2008
svy: mean asiantherm if rep==1 & VCF0004>2006


svy: mean femtherm if dem==1 & VCF0004>1986 & VCF0004<2008
svy: mean femtherm if dem==1 & VCF0004>2006
svy: mean femtherm if rep==1 & VCF0004>1986 & VCF0004<2008
svy: mean femtherm if rep==1 & VCF0004>2006

svy: mean fundtherm if dem==1 & VCF0004>1986 & VCF0004<2008
svy: mean fundtherm if dem==1 & VCF0004>2006
svy: mean fundtherm if rep==1 & VCF0004>1986 & VCF0004<2008
svy: mean fundtherm if rep==1 & VCF0004>2006

svy: mean gaytherm if dem==1 & VCF0004>1986 & VCF0004<2008
svy: mean gaytherm if dem==1 & VCF0004>2006
svy: mean gaytherm if rep==1 & VCF0004>1986 & VCF0004<2008
svy: mean gaytherm if rep==1 & VCF0004>2006

svy: mean jewtherm if dem==1 & VCF0004>1986 & VCF0004<2008
svy: mean jewtherm if dem==1 & VCF0004>2006
svy: mean jewtherm if rep==1 & VCF0004>1986 & VCF0004<2008
svy: mean jewtherm if rep==1 & VCF0004>2006


svy: mean alientherm if dem==1 & VCF0004>1986 & VCF0004<2008
svy: mean alientherm if dem==1 & VCF0004>2006
svy: mean alientherm if rep==1 & VCF0004>1986 & VCF0004<2008
svy: mean alientherm if rep==1 & VCF0004>2006

svy: mean poortherm if dem==1 & VCF0004>1986 & VCF0004<2008
svy: mean poortherm if dem==1 & VCF0004>2006
svy: mean poortherm if rep==1 & VCF0004>1986 & VCF0004<2008
svy: mean poortherm if rep==1 & VCF0004>2006

svy: mean welfaretherm if dem==1 & VCF0004>1986 & VCF0004<2008
svy: mean welfaretherm if dem==1 & VCF0004>2006
svy: mean welfaretherm if rep==1 & VCF0004>1986 & VCF0004<2008
svy: mean welfaretherm if rep==1 & VCF0004>2006

svy: mean muslimtherm if dem==1 & VCF0004>1986 & VCF0004<2008
svy: mean muslimtherm if dem==1 & VCF0004>2006
svy: mean muslimtherm if rep==1 & VCF0004>1986 & VCF0004<2008
svy: mean muslimtherm if rep==1 & VCF0004>2006

svy: mean envtherm if dem==1 & VCF0004>1986 & VCF0004<2008
svy: mean envtherm if dem==1 & VCF0004>2006
svy: mean envtherm if rep==1 & VCF0004>1986 & VCF0004<2008
svy: mean envtherm if rep==1 & VCF0004>2006


*therm avg by party, whites only
svy: mean blacktherm if dem==1 & white==1 & VCF0004>1986 & VCF0004<2008
svy: mean blacktherm if dem==1 & white==1 & VCF0004>2006
svy: mean blacktherm if rep==1 & white==1 & VCF0004>1986 & VCF0004<2008
svy: mean blacktherm if rep==1 & white==1 & VCF0004>2006

svy: mean hisptherm if dem==1 & white==1 & VCF0004>1986 & VCF0004<2008
svy: mean hisptherm if dem==1 & white==1 & VCF0004>2006
svy: mean hisptherm if rep==1 & white==1 & VCF0004>1986 & VCF0004<2008
svy: mean hisptherm if rep==1 & white==1 & VCF0004>2006


svy: mean asiantherm if dem==1 & white==1 & VCF0004>1986 & VCF0004<2008
svy: mean asiantherm if dem==1 & white==1 & VCF0004>2006
svy: mean asiantherm if rep==1 & white==1 & VCF0004>1986 & VCF0004<2008
svy: mean asiantherm if rep==1 & white==1 & VCF0004>2006


svy: mean femtherm if dem==1 & white==1 & VCF0004>1986 & VCF0004<2008
svy: mean femtherm if dem==1 & white==1 & VCF0004>2006
svy: mean femtherm if rep==1 & white==1 & VCF0004>1986 & VCF0004<2008
svy: mean femtherm if rep==1 & white==1 & VCF0004>2006

svy: mean fundtherm if dem==1 & white==1 & VCF0004>1986 & VCF0004<2008
svy: mean fundtherm if dem==1 & white==1 & VCF0004>2006
svy: mean fundtherm if rep==1 & white==1 & VCF0004>1986 & VCF0004<2008
svy: mean fundtherm if rep==1 & white==1 & VCF0004>2006

svy: mean gaytherm if dem==1 & white==1 & VCF0004>1986 & VCF0004<2008
svy: mean gaytherm if dem==1 & white==1 & VCF0004>2006
svy: mean gaytherm if rep==1 & white==1 & VCF0004>1986 & VCF0004<2008
svy: mean gaytherm if rep==1 & white==1 & VCF0004>2006

svy: mean jewtherm if dem==1 & white==1 & VCF0004>1986 & VCF0004<2008
svy: mean jewtherm if dem==1 & white==1 & VCF0004>2006
svy: mean jewtherm if rep==1 & white==1 & VCF0004>1986 & VCF0004<2008
svy: mean jewtherm if rep==1 & white==1 & VCF0004>2006


svy: mean alientherm if dem==1 & white==1 & VCF0004>1986 & VCF0004<2008
svy: mean alientherm if dem==1 & white==1 & VCF0004>2006
svy: mean alientherm if rep==1 & white==1 & VCF0004>1986 & VCF0004<2008
svy: mean alientherm if rep==1 & white==1 & VCF0004>2006

svy: mean poortherm if dem==1 & white==1 & VCF0004>1986 & VCF0004<2008
svy: mean poortherm if dem==1 & white==1 & VCF0004>2006
svy: mean poortherm if rep==1 & white==1 & VCF0004>1986 & VCF0004<2008
svy: mean poortherm if rep==1 & white==1 & VCF0004>2006

svy: mean welfaretherm if dem==1 & white==1 & VCF0004>1986 & VCF0004<2008
svy: mean welfaretherm if dem==1 & white==1 & VCF0004>2006
svy: mean welfaretherm if rep==1 & white==1 & VCF0004>1986 & VCF0004<2008
svy: mean welfaretherm if rep==1 & white==1 & VCF0004>2006

svy: mean muslimtherm if dem==1 & white==1 & VCF0004>1986 & VCF0004<2008
svy: mean muslimtherm if dem==1 & white==1 & VCF0004>2006
svy: mean muslimtherm if rep==1 & white==1 & VCF0004>1986 & VCF0004<2008
svy: mean muslimtherm if rep==1 & white==1 & VCF0004>2006

svy: mean envtherm if dem==1 & white==1 & VCF0004>1986 & VCF0004<2008
svy: mean envtherm if dem==1 & white==1 & VCF0004>2006
svy: mean envtherm if rep==1 & white==1 & VCF0004>1986 & VCF0004<2008
svy: mean envtherm if rep==1 & white==1 & VCF0004>2006


*therm average by zscore cutoffs (left and right), all races, before and after Obama

svy: mean blacktherm if VCF0004>1986 & VCF0004<2008 & zblacktherm>.5
svy: mean blacktherm if VCF0004>2006 & zblacktherm>.5
svy: mean blacktherm if VCF0004>1986 & VCF0004<2008 & zblacktherm<-.5
svy: mean blacktherm if VCF0004>2006 & zblacktherm<-.5

svy: mean hisptherm if VCF0004>1986 & VCF0004<2008 & zhisptherm>.5
svy: mean hisptherm if VCF0004>2006 & zhisptherm>.5
svy: mean hisptherm if VCF0004>1986 & VCF0004<2008 & zhisptherm<-.5
svy: mean hisptherm if VCF0004>2006 & zhisptherm<-.5

svy: mean asiantherm if VCF0004>1986 & VCF0004<2008 & zasiantherm>.5
svy: mean asiantherm if VCF0004>2006 & zasiantherm>.5
svy: mean asiantherm if VCF0004>1986 & VCF0004<2008 & zasiantherm<-.5
svy: mean asiantherm if VCF0004>2006 & zasiantherm<-.5

svy: mean femtherm if VCF0004>1986 & VCF0004<2008 & zfemtherm>.5
svy: mean femtherm if VCF0004>2006 & zfemtherm>.5
svy: mean femtherm if VCF0004>1986 & VCF0004<2008 & zfemtherm<-.5
svy: mean femtherm if VCF0004>2006 & zfemtherm<-.5

svy: mean fundtherm if VCF0004>1986 & VCF0004<2008 & zfundtherm>.5
svy: mean fundtherm if VCF0004>2006 & zfundtherm>.5
svy: mean fundtherm if VCF0004>1986 & VCF0004<2008 & zfundtherm<-.5
svy: mean fundtherm if VCF0004>2006 & zfundtherm<-.5

svy: mean gaytherm if VCF0004>1986 & VCF0004<2008 & zgaytherm>.5
svy: mean gaytherm if VCF0004>2006 & zgaytherm>.5
svy: mean gaytherm if VCF0004>1986 & VCF0004<2008 & zgaytherm<-.5
svy: mean gaytherm if VCF0004>2006 & zgaytherm<-.5

svy: mean jewtherm if VCF0004>1986 & VCF0004<2008 & zjewtherm>.5
svy: mean jewtherm if VCF0004>2006 & zjewtherm>.5
svy: mean jewtherm if VCF0004>1986 & VCF0004<2008 & zjewtherm<-.5
svy: mean jewtherm if VCF0004>2006 & zjewtherm<-.5


svy: mean alientherm if VCF0004>1986 & VCF0004<2008 & zalientherm>.5
svy: mean alientherm if VCF0004>2006 & zalientherm>.5
svy: mean alientherm if VCF0004>1986 & VCF0004<2008 & zalientherm<-.5
svy: mean alientherm if VCF0004>2006 & zalientherm<-.5

svy: mean poortherm if VCF0004>1986 & VCF0004<2008 & zpoortherm>.5
svy: mean poortherm if VCF0004>2006 & zpoortherm>.5
svy: mean poortherm if VCF0004>1986 & VCF0004<2008 & zpoortherm<-.5
svy: mean poortherm if VCF0004>2006 & zpoortherm<-.5

svy: mean welfaretherm if VCF0004>1986 & VCF0004<2008 & zwelfaretherm>.5
svy: mean welfaretherm if VCF0004>2006 & zwelfaretherm>.5
svy: mean welfaretherm if VCF0004>1986 & VCF0004<2008 & zwelfaretherm<-.5
svy: mean welfaretherm if VCF0004>2006 & zwelfaretherm<-.5

svy: mean muslimtherm if VCF0004>1986 & VCF0004<2008 & zmuslimtherm>.5
svy: mean muslimtherm if VCF0004>2006 & zmuslimtherm>.5
svy: mean muslimtherm if VCF0004>1986 & VCF0004<2008 & zmuslimtherm<-.5
svy: mean muslimtherm if VCF0004>2006 & zmuslimtherm<-.5

svy: mean envtherm if VCF0004>1986 & VCF0004<2008 & zenvtherm>.5
svy: mean envtherm if VCF0004>2006 & zenvtherm>.5
svy: mean envtherm if VCF0004>1986 & VCF0004<2008 & zenvtherm<-.5
svy: mean envtherm if VCF0004>2006 & zenvtherm<-.5


*therm averages by zscore cutoff, whites only, before and after Obama


svy: mean blacktherm if VCF0004>1986 & VCF0004<2008 & zblacktherm>.5 & white==1
svy: mean blacktherm if VCF0004>2006 & zblacktherm>.5 & white==1
svy: mean blacktherm if VCF0004>1986 & VCF0004<2008 & zblacktherm<-.5 & white==1
svy: mean blacktherm if VCF0004>2006 & zblacktherm<-.5 & white==1

svy: mean hisptherm if VCF0004>1986 & VCF0004<2008 & zhisptherm>.5 & white==1
svy: mean hisptherm if VCF0004>2006 & zhisptherm>.5 & white==1
svy: mean hisptherm if VCF0004>1986 & VCF0004<2008 & zhisptherm<-.5 & white==1
svy: mean hisptherm if VCF0004>2006 & zhisptherm<-.5 & white==1

svy: mean asiantherm if VCF0004>1986 & VCF0004<2008 & zasiantherm>.5 & white==1
svy: mean asiantherm if VCF0004>2006 & zasiantherm>.5 & white==1
svy: mean asiantherm if VCF0004>1986 & VCF0004<2008 & zasiantherm<-.5 & white==1
svy: mean asiantherm if VCF0004>2006 & zasiantherm<-.5 & white==1

svy: mean femtherm if VCF0004>1986 & VCF0004<2008 & zfemtherm>.5 & white==1
svy: mean femtherm if VCF0004>2006 & zfemtherm>.5 & white==1
svy: mean femtherm if VCF0004>1986 & VCF0004<2008 & zfemtherm<-.5 & white==1
svy: mean femtherm if VCF0004>2006 & zfemtherm<-.5 & white==1

svy: mean fundtherm if VCF0004>1986 & VCF0004<2008 & zfundtherm>.5 & white==1
svy: mean fundtherm if VCF0004>2006 & zfundtherm>.5 & white==1
svy: mean fundtherm if VCF0004>1986 & VCF0004<2008 & zfundtherm<-.5 & white==1
svy: mean fundtherm if VCF0004>2006 & zfundtherm<-.5 & white==1

svy: mean gaytherm if VCF0004>1986 & VCF0004<2008 & zgaytherm>.5 & white==1
svy: mean gaytherm if VCF0004>2006 & zgaytherm>.5 & white==1
svy: mean gaytherm if VCF0004>1986 & VCF0004<2008 & zgaytherm<-.5 & white==1
svy: mean gaytherm if VCF0004>2006 & zgaytherm<-.5 & white==1


svy: mean jewtherm if VCF0004>1986 & VCF0004<2008 & zjewtherm>.5 & white==1
svy: mean jewtherm if VCF0004>2006 & zjewtherm>.5 & white==1
svy: mean jewtherm if VCF0004>1986 & VCF0004<2008 & zjewtherm<-.5 & white==1
svy: mean jewtherm if VCF0004>2006 & zjewtherm<-.5 & white==1

svy: mean alientherm if VCF0004>1986 & VCF0004<2008 & zalientherm>.5 & white==1
svy: mean alientherm if VCF0004>2006 & zalientherm>.5 & white==1
svy: mean alientherm if VCF0004>1986 & VCF0004<2008 & zalientherm<-.5 & white==1
svy: mean alientherm if VCF0004>2006 & zalientherm<-.5 & white==1

svy: mean poortherm if VCF0004>1986 & VCF0004<2008 & zpoortherm>.5 & white==1
svy: mean poortherm if VCF0004>2006 & zpoortherm>.5 & white==1
svy: mean poortherm if VCF0004>1986 & VCF0004<2008 & zpoortherm<-.5 & white==1
svy: mean poortherm if VCF0004>2006 & zpoortherm<-.5 & white==1

svy: mean welfaretherm if VCF0004>1986 & VCF0004<2008 & zwelfaretherm>.5 & white==1
svy: mean welfaretherm if VCF0004>2006 & zwelfaretherm>.5 & white==1
svy: mean welfaretherm if VCF0004>1986 & VCF0004<2008 & zwelfaretherm<-.5 & white==1
svy: mean welfaretherm if VCF0004>2006 & zwelfaretherm<-.5 & white==1

svy: mean muslimtherm if VCF0004>1986 & VCF0004<2008 & zmuslimtherm>.5 & white==1
svy: mean muslimtherm if VCF0004>2006 & zmuslimtherm>.5 & white==1
svy: mean muslimtherm if VCF0004>1986 & VCF0004<2008 & zmuslimtherm<-.5 & white==1
svy: mean muslimtherm if VCF0004>2006 & zmuslimtherm<-.5 & white==1

svy: mean envtherm if VCF0004>1986 & VCF0004<2008 & zenvtherm>.5 & white==1
svy: mean envtherm if VCF0004>2006 & zenvtherm>.5 & white==1
svy: mean envtherm if VCF0004>1986 & VCF0004<2008 & zenvtherm<-.5 & white==1
svy: mean envtherm if VCF0004>2006 & zenvtherm<-.5 & white==1



*********************************

*therm sort: fem, hisp, black, poor; for figure 1

gen sortright25=0
replace sortright25=1 if zfemtherm<-.5 & zhisptherm<-.5 & zblacktherm<-.5 & zpoortherm>=-.5
replace sortright25=1 if zfemtherm<-.5 & zhisptherm<-.5 & zblacktherm>=-.5 & zpoortherm<-.5
replace sortright25=1 if zfemtherm<-.5 & zhisptherm>=-.5 & zblacktherm<-.5 & zpoortherm<-.5
replace sortright25=1 if zfemtherm>=-.5 & zhisptherm<-.5 & zblacktherm<-.5 & zpoortherm<-.5
replace sortright25=1 if zfemtherm<-.5 & zhisptherm<-.5 & zblacktherm<-.5 & zpoortherm<-.5
replace sortright25=. if zfemtherm==.
replace sortright25=. if zhisptherm==.
replace sortright25=. if zblacktherm==.
replace sortright25=. if zpoortherm==.


gen sortleft25=0
replace sortleft25=1 if zfemtherm>.5 & zhisptherm>.5 & zblacktherm>.5 & zpoortherm<=.5
replace sortleft25=1 if zfemtherm>.5 & zhisptherm>.5 & zblacktherm<=.5 & zpoortherm>.5
replace sortleft25=1 if zfemtherm>.5 & zhisptherm<=.5 & zblacktherm>.5 & zpoortherm>.5
replace sortleft25=1 if zfemtherm<=.5 & zhisptherm>.5 & zblacktherm>.5 & zpoortherm>.5
replace sortleft25=1 if zfemtherm>.5 & zhisptherm>.5 & zblacktherm>.5 & zpoortherm>.5
replace sortleft25=. if zfemtherm==.
replace sortleft25=. if zhisptherm==.
replace sortleft25=. if zblacktherm==.
replace sortleft25=. if zpoortherm==.

*pooled data for figure 1


svy: mean sortleft25 if obamayears==0
svy: mean sortright25 if obamayears==0
svy: mean sortleft25 if obamayears==1
svy: mean sortright25 if obamayears==1


svy: mean sortleft25 if obamayears==0 & white==1
svy: mean sortright25 if obamayears==0 & white==1
svy: mean sortleft25 if obamayears==1 & white==1
svy: mean sortright25 if obamayears==1 & white==1

svy: mean sortleft25 if obamayears==0 & black==1
svy: mean sortright25 if obamayears==0 & black==1
svy: mean sortleft25 if obamayears==1 & black==1
svy: mean sortright25 if obamayears==1 & black==1

svy: mean sortleft25 if obamayears==0 & religious==1
svy: mean sortright25 if obamayears==0 & religious==1
svy: mean sortleft25 if obamayears==1 & religious==1
svy: mean sortright25 if obamayears==1 & religious==1




***************************
*Appendix

**Supplmentary figure 1: therm alignment on black, feminist, fundamentalist, poor therms


gen sortright12=0
replace sortright12=1 if zfemtherm<-.5 & zfundtherm1<-.5 & zblacktherm<-.5 & zpoortherm>=-.5
replace sortright12=1 if zfemtherm<-.5 & zfundtherm1<-.5 & zblacktherm>=-.5 & zpoortherm<-.5
replace sortright12=1 if zfemtherm<-.5 & zfundtherm1>=-.5 & zblacktherm<-.5 & zpoortherm<-.5
replace sortright12=1 if zfemtherm>=-.5 & zfundtherm1<-.5 & zblacktherm<-.5 & zpoortherm<-.5
replace sortright12=1 if zfemtherm<-.5 & zfundtherm1<-.5 & zblacktherm<-.5 & zpoortherm<-.5
replace sortright12=. if zfemtherm==.
replace sortright12=. if zfundtherm==.
replace sortright12=. if zblacktherm==.
replace sortright12=. if zpoortherm==.


gen sortleft12=0
replace sortleft12=1 if zfemtherm>.5 & zfundtherm1>.5 & zblacktherm>.5 & zpoortherm<=.5
replace sortleft12=1 if zfemtherm>.5 & zfundtherm1>.5 & zblacktherm<=.5 & zpoortherm>.5
replace sortleft12=1 if zfemtherm>.5 & zfundtherm1<=.5 & zblacktherm>.5 & zpoortherm>.5
replace sortleft12=1 if zfemtherm<=.5 & zfundtherm1>.5 & zblacktherm>.5 & zpoortherm>.5
replace sortleft12=1 if zfemtherm>.5 & zfundtherm1>.5 & zblacktherm>.5 & zpoortherm>.5
replace sortleft12=. if zfemtherm==.
replace sortleft12=. if zfundtherm==.
replace sortleft12=. if zblacktherm==.
replace sortleft12=. if zpoortherm==.



svy: mean sortleft12 if obamayears==0
svy: mean sortright12 if obamayears==0
svy: mean sortleft12 if obamayears==1
svy: mean sortright12 if obamayears==1


svy: mean sortleft12 if obamayears==0 & white==1
svy: mean sortright12 if obamayears==0 & white==1
svy: mean sortleft12 if obamayears==1 & white==1
svy: mean sortright12 if obamayears==1 & white==1

svy: mean sortleft12 if obamayears==0 & black==1
svy: mean sortright12 if obamayears==0 & black==1
svy: mean sortleft12 if obamayears==1 & black==1
svy: mean sortright12 if obamayears==1 & black==1

svy: mean sortleft12 if obamayears==0 & religious==1
svy: mean sortright12 if obamayears==0 & religious==1
svy: mean sortleft12 if obamayears==1 & religious==1
svy: mean sortright12 if obamayears==1 & religious==1





*Supplementary figure 2: determining alignment by fem, gay, black, poor

gen sortright27=0
replace sortright27=1 if zfemtherm<-.5 & zgaytherm<-.5 & zblacktherm<-.5 & zpoortherm>=-.5
replace sortright27=1 if zfemtherm<-.5 & zgaytherm<-.5 & zblacktherm>=-.5 & zpoortherm<-.5
replace sortright27=1 if zfemtherm<-.5 & zgaytherm>=-.5 & zblacktherm<-.5 & zpoortherm<-.5
replace sortright27=1 if zfemtherm>=-.5 & zgaytherm<-.5 & zblacktherm<-.5 & zpoortherm<-.5
replace sortright27=1 if zfemtherm<-.5 & zgaytherm<-.5 & zblacktherm<-.5 & zpoortherm<-.5
replace sortright27=. if zfemtherm==.
replace sortright27=. if zgaytherm==.
replace sortright27=. if zblacktherm==.
replace sortright27=. if zpoortherm==.


gen sortleft27=0
replace sortleft27=1 if zfemtherm>.5 & zgaytherm>.5 & zblacktherm>.5 & zpoortherm<=.5
replace sortleft27=1 if zfemtherm>.5 & zgaytherm>.5 & zblacktherm<=.5 & zpoortherm>.5
replace sortleft27=1 if zfemtherm>.5 & zgaytherm<=.5 & zblacktherm>.5 & zpoortherm>.5
replace sortleft27=1 if zfemtherm<=.5 & zgaytherm>.5 & zblacktherm>.5 & zpoortherm>.5
replace sortleft27=1 if zfemtherm>.5 & zgaytherm>.5 & zblacktherm>.5 & zpoortherm>.5
replace sortleft27=. if zfemtherm==.
replace sortleft27=. if zgaytherm==.
replace sortleft27=. if zblacktherm==.
replace sortleft27=. if zpoortherm==.



svy: mean sortleft27 if obamayears==0
svy: mean sortright27 if obamayears==0
svy: mean sortleft27 if obamayears==1
svy: mean sortright27 if obamayears==1

svy: mean sortleft27 if obamayears==0 & white==1
svy: mean sortright27 if obamayears==0 & white==1
svy: mean sortleft27 if obamayears==1 & white==1
svy: mean sortright27 if obamayears==1 & white==1

svy: mean sortleft27 if obamayears==0 & black==1
svy: mean sortright27 if obamayears==0 & black==1
svy: mean sortleft27 if obamayears==1 & black==1
svy: mean sortright27 if obamayears==1 & black==1

svy: mean sortleft27 if obamayears==0 & religious==1
svy: mean sortright27 if obamayears==0 & religious==1
svy: mean sortleft27 if obamayears==1 & religious==1
svy: mean sortright27 if obamayears==1 & religious==1



***supplementary figure 3: therm sort on feminist, black, illegal aliens, people on welfare


gen sortright13=0
replace sortright13=1 if zfemtherm<-.5 & zalientherm<-.5 & zblacktherm<-.5 & zwelfaretherm>=-.5
replace sortright13=1 if zfemtherm<-.5 & zalientherm<-.5 & zblacktherm>=-.5 & zwelfaretherm<-.5
replace sortright13=1 if zfemtherm<-.5 & zalientherm>=-.5 & zblacktherm<-.5 & zwelfaretherm<-.5
replace sortright13=1 if zfemtherm>=-.5 & zalientherm<-.5 & zblacktherm<-.5 & zwelfaretherm<-.5
replace sortright13=1 if zfemtherm<-.5 & zalientherm<-.5 & zblacktherm<-.5 & zwelfaretherm<-.5
replace sortright13=. if zfemtherm==.
replace sortright13=. if zalientherm==.
replace sortright13=. if zblacktherm==.
replace sortright13=. if zwelfaretherm==.

gen sortleft13=0
replace sortleft13=1 if zfemtherm>.5 & zalientherm>.5 & zblacktherm>.5 & zwelfaretherm<=.5
replace sortleft13=1 if zfemtherm>.5 & zalientherm>.5 & zblacktherm<=.5 & zwelfaretherm>.5
replace sortleft13=1 if zfemtherm>.5 & zalientherm<=.5 & zblacktherm>.5 & zwelfaretherm>.5
replace sortleft13=1 if zfemtherm<=.5 & zalientherm>.5 & zblacktherm>.5 & zwelfaretherm>.5
replace sortleft13=1 if zfemtherm>.5 & zalientherm>.5 & zblacktherm>.5 & zwelfaretherm>.5
replace sortleft13=. if zfemtherm==.
replace sortleft13=. if zalientherm==.
replace sortleft13=. if zblacktherm==.
replace sortleft13=. if zwelfaretherm==.



*pooled data, for Supplementary Figure 3

svy: mean sortleft13 if obamayears==0
svy: mean sortright13 if obamayears==0
svy: mean sortleft13 if obamayears==1
svy: mean sortright13 if obamayears==1

svy: mean sortleft13 if obamayears==0 & white==1
svy: mean sortright13 if obamayears==0 & white==1
svy: mean sortleft13 if obamayears==1 & white==1
svy: mean sortright13 if obamayears==1 & white==1

svy: mean sortleft13 if obamayears==0 & black==1
svy: mean sortright13 if obamayears==0 & black==1
svy: mean sortleft13 if obamayears==1 & black==1
svy: mean sortright13 if obamayears==1 & black==1

svy: mean sortleft13 if obamayears==0 & religious==1
svy: mean sortright13 if obamayears==0 & religious==1
svy: mean sortleft13 if obamayears==1 & religious==1
svy: mean sortright13 if obamayears==1 & religious==1






*supplementary figure: fixed or fluid trend



svy: mean fixed if  VCF0004==1992
svy: mean fixed if  VCF0004==2000
svy: mean fixed if  VCF0004==2004
svy: mean fixed if  VCF0004==2008
svy: mean fixed if  VCF0004==2012
svy: mean fixed if  VCF0004==2016


svy: mean fluid if  VCF0004==1992
svy: mean fluid if  VCF0004==2000
svy: mean fluid if  VCF0004==2004
svy: mean fluid if  VCF0004==2008
svy: mean fluid if  VCF0004==2012
svy: mean fluid if  VCF0004==2016


svy: mean fixed if  VCF0004==1992 & white==1
svy: mean fixed if  VCF0004==2000 & white==1
svy: mean fixed if  VCF0004==2004 & white==1
svy: mean fixed if  VCF0004==2008 & white==1
svy: mean fixed if  VCF0004==2012 & white==1
svy: mean fixed if  VCF0004==2016 & white==1

svy: mean fluid if  VCF0004==1992 & white==1
svy: mean fluid if  VCF0004==2000 & white==1
svy: mean fluid if  VCF0004==2004 & white==1
svy: mean fluid if  VCF0004==2008 & white==1
svy: mean fluid if  VCF0004==2012 & white==1
svy: mean fluid if  VCF0004==2016 & white==1


svy: mean fixed if  VCF0004==1992 & white==0
svy: mean fixed if  VCF0004==2000 & white==0
svy: mean fixed if  VCF0004==2004 & white==0
svy: mean fixed if  VCF0004==2008 & white==0
svy: mean fixed if  VCF0004==2012 & white==0
svy: mean fixed if  VCF0004==2016 & white==0


svy: mean fluid if  VCF0004==1992 & white==0
svy: mean fluid if  VCF0004==2000 & white==0
svy: mean fluid if  VCF0004==2004 & white==0
svy: mean fluid if  VCF0004==2008 & white==0
svy: mean fluid if  VCF0004==2012 & white==0
svy: mean fluid if  VCF0004==2016 & white==0












